package top.infopub.mgr.bpa.service.impl;

import org.springframework.stereotype.Service;
import top.infopub.mgr.bpa.dao.BpaWeekEffectDetailDao;
import top.infopub.mgr.bpa.service.BpaWeekEffectDetailService;
import top.infopub.mgr.bpa.vo.BpaWeekEffectDetail;
import top.infopub.mgr.bpa.vo.BpaYearEffectDetail;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by wurz on 2bpaWeekEffectDetailDao.21/6/2bpaWeekEffectDetailDao..
 */
@Service
public class BpaWeekEffectDetailServiceImpl implements BpaWeekEffectDetailService {
    @Resource
    private BpaWeekEffectDetailDao bpaWeekEffectDetailDao;

    @Override
    public int insert(BpaWeekEffectDetail bpaWeekEffectDetail) {
        return bpaWeekEffectDetailDao.insert(bpaWeekEffectDetail);
    }

    @Override
    public int deleteByPrimaryKey(String sguid) {
        return bpaWeekEffectDetailDao.deleteByPrimaryKey(sguid);
    }

    @Override
    public int delete(BpaWeekEffectDetail bpaWeekEffectDetail) {
        return bpaWeekEffectDetailDao.delete(bpaWeekEffectDetail);
    }

    @Override
    public int updateByPrimaryKey(BpaWeekEffectDetail bpaWeekEffectDetail) {
        return bpaWeekEffectDetailDao.updateByPrimaryKey(bpaWeekEffectDetail);
    }

    @Override
    public BpaWeekEffectDetail selectOne(String sguid) {
        return bpaWeekEffectDetailDao.selectOne(sguid);
    }

    @Override
    public List<BpaWeekEffectDetail> selectList(BpaWeekEffectDetail bpaWeekEffectDetail) {
        return bpaWeekEffectDetailDao.selectList(bpaWeekEffectDetail);
    }

    @Override
    public int selectCount(BpaWeekEffectDetail bpaWeekEffectDetail) {
        return bpaWeekEffectDetailDao.selectCount(bpaWeekEffectDetail);
    }

    @Override
    public int insertBatch(List<BpaWeekEffectDetail> bpaWeekEffectDetailList) {
        return bpaWeekEffectDetailDao.insertBatch(bpaWeekEffectDetailList);
    }
    @Override
    public void update(List<BpaWeekEffectDetail> list) {
        if (list == null || list.size() == 0){
            return;
        }
        bpaWeekEffectDetailDao.deleteByZdId(list.get(0).getZdId());
        this.insertBatch(list);
    }
}
